home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / comm / mail / YAMscripts.lha / GEOreply.rexx < prev    next >
OS/2 REXX Batch file  |  1997-04-21  |  1KB  |  60 lines

  1. /* Skips the HTML part of a message and replies to the second part.
  2. ** 
  3. */ 
  4. options results
  5. tmp='t:letter.tmp'
  6. quote='> '
  7. wrap=76
  8.  
  9. address 'YAM'
  10. 'GetMailInfo file'
  11. if rc>0 then do
  12.     'Request "Select a message first!" "_Ok"'
  13.     exit
  14.     end
  15. else
  16.     file=result
  17.  
  18. if open(in,file,'r') & open(out,tmp,'w') then do
  19.     BeenThereDoneThat=0
  20.     do until r='' | eof(in)
  21.         r=readln(in)
  22.         if word(r,1)='Content-Type:' & ~BeenThereDoneThat then do
  23.             r=translate(r,' ','"')
  24.             boundary=word(r,words(r))
  25.             BeenThereDoneThat=1
  26.             end /* if word */
  27.         end /* do until */
  28.     BoundaryCounter=0
  29.     do until eof(in) | (BoundaryCounter=2 & r='')
  30.         r=strip(readln(in))
  31.         if pos(boundary,r)>0 then BoundaryCounter=BoundaryCounter+1
  32.         end /* do until */
  33.     do until eof(in) | r=boundary
  34.         r=readln(in)
  35.         if pos(boundary,r)=0 & ~eof(in) then call QuoteLine(r)
  36.         end /*do until */
  37.     call close(in)
  38.     call close(out)
  39.     end /* if open */
  40. else do
  41.     'Request "Can not copy letter!" "_Ok"'
  42.     exit
  43.     end
  44.  
  45. 'MailReply'
  46. 'WriteLetter "'tmp'"' 
  47. exit
  48.  
  49. QuoteLine:
  50. parse arg str
  51.     if length(quote || str) > wrap then do
  52.         p=lastpos(' ',str,wrap - length(quote))
  53.         if p=0 then p=wrap - length(quote)
  54.         call writeln(out,quote || left(str,p))
  55.         call QuoteLine(substr(str,p+1))
  56.         end
  57.     else
  58.         call writeln(out,quote || str)
  59. return
  60.